Skip to content

Test static route #3297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 6, 2021
Merged

Test static route #3297

merged 6 commits into from
May 6, 2021

Conversation

code-asher
Copy link
Member

@code-asher code-asher commented May 5, 2021

Mostly just wanted to add a test for static auth.

@codecov
Copy link

codecov bot commented May 5, 2021

Codecov Report

Merging #3297 (e8443e2) into main (3243bb3) will increase coverage by 1.99%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3297      +/-   ##
==========================================
+ Coverage   56.95%   58.95%   +1.99%     
==========================================
  Files          35       35              
  Lines        1703     1703              
  Branches      374      374              
==========================================
+ Hits          970     1004      +34     
+ Misses        583      561      -22     
+ Partials      150      138      -12     
Impacted Files Coverage Δ
src/node/util.ts 50.00% <0.00%> (+1.02%) ⬆️
src/node/cli.ts 79.57% <0.00%> (+1.70%) ⬆️
src/node/main.ts 40.22% <0.00%> (+3.44%) ⬆️
src/node/http.ts 32.78% <0.00%> (+4.91%) ⬆️
src/node/routes/index.ts 77.14% <0.00%> (+9.52%) ⬆️
src/node/routes/static.ts 60.46% <0.00%> (+30.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3243bb3...e8443e2. Read the comment docs.

@code-asher code-asher marked this pull request as ready for review May 5, 2021 23:05
@code-asher code-asher requested a review from a team as a code owner May 5, 2021 23:05
@jsjoeio jsjoeio added the testing Anything related to testing label May 5, 2021
@jsjoeio jsjoeio added this to the v3.9.4 milestone May 5, 2021
Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

Mostly nits around test names and then a question

@code-asher code-asher force-pushed the test-static branch 6 times, most recently from b44ba1e to e382328 Compare May 6, 2021 16:29
@code-asher code-asher marked this pull request as draft May 6, 2021 16:52
@code-asher
Copy link
Member Author

code-asher commented May 6, 2021

I need to refactor the logger module mock because it causes errors in the e2e tests (now that the terminal test imports the helper file) but that conflicts with some constant test changes you're making so I'm going to wait for that to get merged then rebase.

@jsjoeio
Copy link
Contributor

jsjoeio commented May 6, 2021

I'm going to wait for that to get merged then rebase.

code-asher added 5 commits May 6, 2021 14:25
This is to match the other tests that create temp directories. It also
lets you clean up test temp directories all at once separately from
other non-test temporary directories.
Just to limit all the noise from code-server's startup output.
@code-asher code-asher force-pushed the test-static branch 2 times, most recently from 01f695f to eb34f4b Compare May 6, 2021 19:47
@code-asher code-asher marked this pull request as ready for review May 6, 2021 20:01
@code-asher code-asher requested a review from jsjoeio May 6, 2021 20:01
It errors that jest is not defined so put it behind a function instead
of immediately creating the mock (this is probably a better pattern
anyway).

The constant tests had to be reworked a little. Since the logger mock is
hoisted it runs before createLoggerMock is imported. I moved it into a
beforeAll which means the require call also needed to be moved
there (since we need to mock the logger before requiring the constants
or it'll pull the non-mocked logger).

This means getPackageJson needs to be a let and assigned afterward. To
avoid having to define a type for getPackageJson I just added a let var
set to the type of the imported constants file and modified the other
areas to use the same paradigm.

I also replaced some hardcoded strings with the mocked package.json
object.
Copy link
Contributor

@jsjoeio jsjoeio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

@code-asher code-asher merged commit 4f320ad into coder:main May 6, 2021
@code-asher code-asher deleted the test-static branch May 6, 2021 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Anything related to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants